package com.foo.midterm;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.foo.midterm.MainActivity;
import com.foo.midterm.R;

public class DisplayMessageActivity extends AppCompatActivity {

    @Override
    //创建时自己回调
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_display_message);

        //获取意图
        Intent intent = getIntent();
        //获取意图中的附加数据
        String message = intent.getStringExtra(MainActivity.EXTRA_INF);
        //TestView中显示消息
        TextView textView = findViewById(R.id.textView);
        textView.setText(message);
        String[] inf = intent.getStringArrayExtra(MainActivity.EXTRA_INF);
        textView.setText("学号为：20190203333" + "\n" + "用户名为：" + inf[0] + "\n" + "密码为：" + inf[1]);
    }
}